#include "stdafx.h"
#include "CText.h"

NAMESPACE_CORE_BEGIN

CTextW ToUnicodeText(const char_8 * pString)
{
	CTextW text;
	uint_x suitSize_t = 0;
	mbstowcs_s((size_t *)&suitSize_t, 0, 0, pString, 0);
	text.SetLength(suitSize_t - 1);
	mbstowcs_s((size_t *)&suitSize_t, text.GetBuffer(), suitSize_t, pString, -1);
	return text;
}

CTextA ToAnsiText(const char_16 * pString)
{
	CTextA text;
	uint_x suitSize_t = 0;
	wcstombs_s((size_t *)&suitSize_t, 0, 0, pString, 0);
	text.SetLength(suitSize_t - 1);
	wcstombs_s((size_t *)&suitSize_t, text.GetBuffer(), suitSize_t, pString, - 1);
	return text;
}

NAMESPACE_CORE_END
